The present disclosure relates to a video-recording and replaying apparatus, I/O scheduling method, and program capable of performing I/O scheduling on a block device in a multitask environment.
In recent years, general video-recording and replaying apparatuses can perform simultaneous video-recording of a plurality of channels and video-recording of a program while replaying a video-recorded program. As a storage for these video-recording and replaying apparatuses, a block device is used, such as a Blu-ray drive or a hard disk drive. The block device is a storage in which data write and read are performed by a predetermined unit (a block unit). Inputs and outputs of data to and from the block device are performed through a file system.
For simultaneous video-recording of a plurality of channels and simultaneous video-recording and replaying for the block device, it is important to impartially allocate I/O (input/output) resources for the block device to each process. I/O scheduling is a technology of impartially allocating I/O resources for the block device to a plurality of tasks.
For example, a CFQ (completely fair queuing) scheduler is an I/O scheduler currently incorporated in a Linux kernel as a standard (refer to Japanese Unexamined Patent Application Publication No. 2010-113524 (paragraphs [005]-[0058])). In the CFQ scheduler, an I/O request is registered in a request queue corresponding to a degree of priority. In each request queue, a time slice determined according to the degree of priority of the I/O request is set. Normally, an I/O request from a task with a relatively high degree of demand for real-time properties is provided with a high degree of priority, and an I/O request from a task with a relatively low degree of demand for real-time properties is provided with a low degree of priority.
The CFQ scheduler merges I/O requests to adjacent sectors into a single data structure called an I/O request for each same type (read request or write request), and registers the I/O request in a request queue. The CFQ scheduler selects one request queue not being blank from among a plurality of request queues with a round-robin scheme, for example, selecting the I/O requests one by one from the selected request queue within the time slice and passing the I/O requests to a device driver. After a lapse of the time slice, the CFQ scheduler selects a request queue with the same or next higher degree of priority, and selects an I/O request from that request queue and passes the I/O request to the device driver. With this, the I/O requests are executed by the device driver.